package com.ruoyi.system.domain.dto;

import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Arrays;
import java.util.List;

public class TCodeDto {

    @Data
    public static class Import{
        @Excel(name = "变量")
        private String code;
        @Excel(name = "变量名称")
        private String text;
        private String pinyinSimple;
        private String pinyinFull;
        @Excel(name = "选择类型")
        private String options;
        @Excel(name = "input类型")
        @ApiModelProperty("要执行的操作")
        private String operatorName;
        @Excel(name = "显示条件")
        @ApiModelProperty("显示条件")
        private String showType;
//        @Excel(name = "模块")
//        private String model;

        @Excel(name = "类别")
        private String tag;

        public List<String> getTag() {
            if (tag == null) {
                return null;
            }
            String[] split = tag.split(",");
            return Arrays.asList(split);
        }
    }

    @Data
    @ApiModel("TCodeDto - Insert")
    public static class Insert {
        @ApiModelProperty("CODE")
        private String code;
        @ApiModelProperty("变量名")
        private String text;
        @ApiModelProperty("选项")
        private String options;
        @ApiModelProperty("要执行的操作")
        private String operatorName;
        @ApiModelProperty("标签名")
        private List<Long> tagIdList;
        @ApiModelProperty("是否必填(0不是 1必填)")
        private Byte required;
    }

    @Data
    @ApiModel("TCodeDto - Update")
    public static class Update {
        @ApiModelProperty("ID")
        private Long id;
        @ApiModelProperty("CODE")
        private String code;
        @ApiModelProperty("变量名")
        private String text;
        @ApiModelProperty("选项")
        private String options;
        @ApiModelProperty("要执行的操作")
        private String operatorName;
        @ApiModelProperty("标签名")
        private List<Long> tagIdList;
        @ApiModelProperty("是否必填(0不是 1必填)")
        private Byte required;

    }

    @Data
    @ApiModel(description = "删除变量")
    public static class Delete {
        @ApiModelProperty("删除ID")
        private List<Long> idList;
    }



    @Data
    public static class Export {
    }

    @Data
    @ApiModel("查询变量")
    public static class Query {
        @ApiModelProperty("CODE")
        private String code;
        @ApiModelProperty("变量名")
        private String text;
        @ApiModelProperty("标签名")
        private List<Long> tagIdList;
    }

    @Data
    @ApiModel(description = "新增标签")
    public static class TagInsert {
        private String name;
    }

    @Data
    @ApiModel(description = "修改标签")
    public static class TagUpdate {
        private Long id;
        private String name;
    }

    @Data
    @ApiModel(description = "删除标签")
    public static class TagDelete {
        private List<Long> idList;
    }

    @Data
    @ApiModel(description = "查询标签")
    public static class QueryTag {
        private String name;
    }
}
